/**
 * Created by sicongdu on 18-4-11.
 */

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/mern-starter');

//teachers information
var teachers_schema = mongoose.Schema({
  name: String,
  teacherNo: String, //id
  userInfo: String,
  sex: String,
  school: String
});

var teachers = mongoose.model('teachers', teachers_schema);

//teachers passwords
var teachers_pass_schema = mongoose.Schema({
  teacherNo: String,
  pass: String
});

var teachers_pass = mongoose.model('teachers_pass', teachers_pass_schema);

//admins information
var admins_schema = mongoose.Schema({
  name: String,
  adminNo: String, //id
  userInfo: String,
  sex: String,
  school: String
});

var admins = mongoose.model('admins', admins_schema);

//admins passwords
var admins_pass_schema = mongoose.Schema({
  adminNo: String,
  pass: String
});

var admins_pass = mongoose.model('admins_pass', admins_pass_schema);

//donators information
var donators_schema = mongoose.Schema({
  donatorNo: String, //id
  name: String,
  sex: String,
  birthday: String,
  phone: String,
  email: String,
  userInfo: String,
  grad_school: String,
  year: String
});

var donators = mongoose.model('donators', donators_schema);

// //donators passwords
// var donators_pass_schema = mongoose.Schema({
//     donatorNo: String,
//     pass: String
// });
//
// var donators_pass = mongoose.model('donators_pass', donators_pass_schema);

//config
var config_schema = mongoose.Schema({
  type: String,
  key: String,
  openId: String
});

var configs = mongoose.model('configs', config_schema);

//school
var school_schema = mongoose.Schema({
  name: String,
});

var schools = mongoose.model('schools', school_schema);


module.exports = {
  teachers: teachers,
  teachers_pass: teachers_pass,
  admins: admins,
  admins_pass: admins_pass,
  donators: donators,
  // donators_pass: donators_pass,
  configs: configs,
  schools: schools
};
